function NewsList() {

}

NewsList.prototype.listenComment = function () {
    var submitBtn = $('.submit-btn-click');
    var textarea = $("textarea[name='comment']");
    submitBtn.click(function () {
        var content = textarea.val();
        var news_id = submitBtn.attr('data-news-id');
        xfzajax.post({
            'url': '/news/public_comment/',
            'data':{
                'content': content,
                'news_id': news_id
            },
            'success': function (result) {
                if(result['code'] === 200){
                    window.messageBox.showSuccess('评论发表成功！');
                    textarea.val("");
                    window.location.reload();
                }else{
                    window.messageBox.showError(result['message']);
                }
            }
        });
    });
}
NewsList.prototype.run = function () {
    this.listenComment();
}
$(function () {
    var newsList = new NewsList();
    newsList.run();
})